package stream;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;

/**
 * @author wang'ji'cheng
 * @date 2025/7/19
 */
public class Demo2 {
    public static void main(String[] args) {
        //双列集合使用stream
        HashMap<String, Integer> map = new HashMap<>();
        map.put("aaa",1);
        map.put("bbb",2);
        map.put("ccc",3);
        map.put("ddd",1);
        Set<String> set1 = map.keySet();
        set1.stream().forEach(s->{System.out.println(s);});
        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        entries.stream().forEach(s-> System.out.println(s));

        //数组使用stream
        int [] arr ={1,2,3,4};
        Arrays.stream(arr).forEach(a-> System.out.println(a));
        String [] str = {"a","b","c"};
        Arrays.stream(str).forEach(s-> System.out.println(s));
        //零散数据
        Stream.of(1,2,3,4).forEach(s-> System.out.println(s));
        Stream.of("a","b","c").forEach(s-> System.out.println(s));

    }
}
